package dshop.model;

import java.util.Date;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

import appbase.jfinal.ext.BaseModel;
import dshop.AppConst;

public class Project extends BaseModel<Project> {

	private static final long serialVersionUID = -6967680902549117464L;

	public static final Project dao = new Project();

	public static final String STRUTS_NORMAL = "NORMAL";
	public static final String STRUTS_END = "END";
	
	public static Record findByProjectId(int projectId) {
		return Db.findFirst("select * from bbs_project where id = ? ",projectId);
	}
	public static void delete(int procurementId) {
		new Project().set("is_delete", AppConst.DELETE_STR_YES).set("delete_date_time", new Date())
				.set("id", procurementId).update();
	}

	public static void setCheckStatus(int procurementId, String checkStatus, String checkStatusExplain) {
		new Project().set("check_status", checkStatus).set("check_status_explain", checkStatusExplain)
				.set("check_date_time", new Date()).set("id", procurementId).update();
	}

	public static void setEnd(int procurementId) {
		dao.updateColumnBy("end_date_time", "id", new Date(), procurementId);
	}

}
